package negocio;

import java.io.Serializable;
import java.util.ArrayList;

import java.util.List;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="informesDeReposicion")
public class InformeReposicion implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id_informe_reposicion" , nullable=false)
	private int id_informe_reposicion;

	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="id_informe_reposicion", referencedColumnName="id_informe_reposicion")
	private List<SolicitudReposicion>informes =new ArrayList<>();

	
	
	
	
	public List<SolicitudReposicion> getInformes() {
		return informes;
	}

	public void setInformes(List<SolicitudReposicion> informes) {
		this.informes = informes;
	}

	public int getId_informe_reposicion() {
		return id_informe_reposicion;
	}

	public void setId_informe_reposicion(int id_informe_reposicion) {
		this.id_informe_reposicion = id_informe_reposicion;
	}

	@Override
	public String toString() {
		return "InformeReposicion [id_informe_reposicion="
				+ id_informe_reposicion + ", informes=" + informes + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id_informe_reposicion;
		result = prime * result
				+ ((informes == null) ? 0 : informes.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		InformeReposicion other = (InformeReposicion) obj;
		if (id_informe_reposicion != other.id_informe_reposicion)
			return false;
		if (informes == null) {
			if (other.informes != null)
				return false;
		} else if (!informes.equals(other.informes))
			return false;
		return true;
	}
	
	
	
	

}
